<template>
  <div>
    <div>账号切换</div>
    <button @click="zhangsan()" type="default" size="mini">张三</button>
    <button @click="lisi()" type="default" size="mini">李四</button>
    <button @click="admin()" type="default" size="mini">admin</button>
    <div>当前token：{{ token }}</div>
  </div>
</template>

<script>
export default {
  name: "Test",

  data() {
    return {
      token: ''
    };
  },

  created(){
    this.token = window.localStorage.getItem('token')
  },

  methods: {
    zhangsan() {
      window.localStorage.setItem('token', '');
      let token = 'eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJScgwN8dANDXYNUtJRSq0oULIyNLMwMDWyMDYy0VEqLU4t8kxRsjKHMPMSc1OBWqoyEvPSixPzlGoBOgZZaEUAAAA.eRtYhMFgAqGFlPjzad9vSp10cwIHECtUKctvtiB7y7hdGjn0hnZ0Xrj9ZCyrN2KVsWoVv23azYykpM4itohvAg'
      window.localStorage.setItem('token', token);
      this.token = window.localStorage.getItem('token')
    },

    lisi() {
      window.localStorage.setItem('token', '');
      let token = 'eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJScgwN8dANDXYNUtJRSq0oULIyNLMwMDWyMLYw0VEqLU4t8kxRsoIy8xJzU4FacjKLM5VqAaoZ-6JBAAAA.wckdQiZ06qK3RQevasrz7NQpuO0EsRzrETQ284tMIGJSUB2d_AhpexE_PD9Do1L8pcGJpf8h_3z-pfX-bmj3Cw'
      window.localStorage.setItem('token', token);
      this.token = window.localStorage.getItem('token')
    },

    admin() {
      window.localStorage.setItem('token', '');
      let token = 'eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJScgwN8dANDXYNUtJRSq0oULIyNLMwMDUyNzA01lEqLU4t8kwBikGYeYm5qUAtiSm5mXlKtQBfhgZHQgAAAA.Fee4dvSl76Pr7NX4EG1UjRUO-PUEtUDO2wkgvun-xQIcOY9p8KYoJRyG6RBm4XM-oLn3L62i1K30YWQ_dmAfFA'
      window.localStorage.setItem('token', token);
      this.token = window.localStorage.getItem('token')
    }
  }
}
</script>
